//
//  LSAppConstant.h
//  LibraryStorm
//
//  Created by sanghv on 3/21/14.
//  Copyright (c) 2014 3ATeam. All rights reserved.
//

#ifndef LibraryStorm_LSAppConstant_h
#define LibraryStorm_LSAppConstant_h

#pragma mark - App Delegate
#define kAppDelegate                (LSAppDelegate *)[UIApplication sharedApplication].delegate
#define DEFAULT_ALL_CATEGORY        0
#define LIMIT_MAX_RECORDS           1000
#define LIMIT_MIN_RECORDS           1
#define LIMIT_DEFAULT_RECORDS       100

#pragma mark - Entity Name
#define BOOK_CATEGORY   @"BookCategory"
#define BOOK_DETAIL     @"BookDetail"
#define BOOK_COLLECTION @"BookCollection"

#pragma mark - Image
#define GRID_IMAGE          [UIImage imageNamed:@"btn_grid"]
#define LIST_IMAGE          [UIImage imageNamed:@"btn_list"]
#define BOOK_COVER_IMAGE    [UIImage imageNamed:@"default_book_cover.jpg"]
#define BOOK_LIKED_IMAGE    [UIImage imageNamed:@"star-on"]
#define BOOK_UNLIKED_IMAGE  [UIImage imageNamed:@"star-off"]
#define ICON_SELECTED       [UIImage imageNamed:@"icon_downloaded"]
#define ICON_NONSELECTED    [UIImage imageNamed:@"icon_nonselected"]
#define ICON_ADD            [UIImage imageNamed:@"icon_add"]

#pragma mark - System Versioning Preprocessor Macros
    #define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
    #define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
    #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
    #define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
    #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

#pragma mark - Current OS and Device Preprocessor Macros
    #define IS_DEVICE_IPAD ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)

    #ifdef NSFoundationVersionNumber_iOS_6_1
        #define SD_IS_IOS7 (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)
    #else
        #define SD_IS_IOS7 NO
    #endif

    #define IS_4INCH_SCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )

#pragma mark - Current Orientation Device Preprocessor Macros
    #define Device_Orientation [[UIApplication sharedApplication] statusBarOrientation]

#pragma mark - Key Web Service
    #define IS_PRODUCTION_VER 1

    #if IS_PRODUCTION_VER
        #define BASE_URL                @""
        #define BASE_SERVICE            @""
    #else
        #define BASE_URL                @""
        #define BASE_SERVICE            @""
    #endif

    #define TIMEOUT_INTERVAL        30
    #define DashedUnderline         @"_"

#pragma mark - Define Interface
    #define LEFT_MENU_WIDTH_IPHONE   270.0f
    #define LEFT_MENU_WIDTH_IPAD     400.0f
    #define STATUSBAR_HEIGHT         20.0f

#pragma mark - Macro Font
    #define System(v)               [UIFont systemFontOfSize:v]
    #define System_Bold(v)          [UIFont boldSystemFontOfSize:v]
    #define Roboto_Regular(v)       [UIFont fontWithName:@"Roboto-Regular" size:v]
    #define Roboto_Bold(v)          [UIFont fontWithName:@"Roboto-Bold" size:v]
    #define Roboto_BoldItalic(v)    [UIFont fontWithName:@"Roboto-BoldItalic" size:v]
    #define Roboto_Italic(v)        [UIFont fontWithName:@"Roboto-Italic" size:v]

#pragma mark - Macro Color
    #define Orange_Color_Alpha [UIColor colorWithRed:0xf8/255.0 green:0x81/255.0 blue:0x19/255.0 alpha:0xEE/255.0]

#pragma mark - Macro AlertView
    #define LSAlert(t,m)                        [[[UIAlertView alloc] initWithTitle:(t) message:(m) delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show]
    #define LSAlertWithDelegate(t,m,d)          [[[UIAlertView alloc] initWithTitle:(t) message:(m) delegate:d cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil] show]

#pragma mark - Key UserDefault
    #define LIMIT_REQUEST_KEY(d)            [NSString stringWithFormat:@"BookStormAPICountOf%@",d]
#pragma mark - Key Segue

#pragma mark - Key Storyboard ID
    #define kSegueCollectionToEpubReader    @"kSegueCollectionToEpubReader"

#pragma mark - Key Notification Center

#pragma mark - Define Pattern Image

#pragma mark - Define Loading HUD
    #define Loading @"Loading..."

#pragma mark - Define General Setting For Epub Reader
#define FontFace    @"FontFace"
#define PageTurn    @"PageTurn"
#define TextSize    @"TextSize"
#define Theme       @"Theme"

#endif
